import React, { useState, useEffect, useLayoutEffect,useRef } from 'react'
import styles from './index.module.less'
import { getUId, throttle } from '../../utils/tool'
import { cloneDeep } from 'lodash'
import classNames from 'classnames'
import { createChart } from 'lightweight-charts';

const isEmptyObject = (obj) => {
	if (typeof obj !== 'object') return false
	const keys = Reflect.ownKeys(obj)
	return !keys.length
}

const Demo = () => {
	const chartRef = useRef()

    useLayoutEffect(() => {
        const chart = createChart(chartRef.current, { width: 400, height: 300 });
        const lineSeries = chart.addLineSeries();
        lineSeries.setData([
            { time: '2019-04-11', value: 80.01 },
            { time: '2019-04-12', value: 96.63 },
            { time: '2019-04-13', value: 76.64 },
            { time: '2019-04-14', value: 81.89 },
            { time: '2019-04-15', value: 74.43 },
            { time: '2019-04-16', value: 80.01 },
            { time: '2019-04-17', value: 96.63 },
            { time: '2019-04-18', value: 76.64 },
            { time: '2019-04-19', value: 81.89 },
            { time: '2019-04-20', value: 74.43 },
        ]);
	}, [])

	return (
		<div className={styles.moveBox}>
			<div id={"chart"} ref={chartRef} />
		</div>
	)
}

export default Demo
